<?php 
// +----------------------------------------------------------------------
// | ThinkSNS
// +----------------------------------------------------------------------
// | Copyright (c) 2009 http://www.thinksns.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: nonant <nonant@thinksns.com>
// +----------------------------------------------------------------------
// 

class WallModel extends Model{
	protected $tableName = "space_wall";
	

	function getWall($uid,$limit){
		$list = $this->where("uid=$uid AND fid=0")->limit($limit)->order('id DESC')->findall();
		foreach ($list as $key=>$val){
			if(0!=$this->where("fid=$val[id]")->count()){
				$list[$key]['reply'] = $this->where("fid=$val[id]")->order('id ASC')->findall();
			}
		}
		return $list;
	}
	
	function delWall($id,$uid){
			$this->where("fid=$id AND uid=$uid")->delete();
			if($this->where("id=$id AND uid=$uid")->delete()){
				return true;
			}else{
				return false;
			}

	}	
}
?>